﻿import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1

StackView {
    id: stack
    objectName: "rectMain"
    initialItem: view
    anchors.fill: parent

    Component {
        id: view

        Rectangle {
            ColumnLayout {
                anchors.fill: parent
                Text {
                    text: stack.depth
                    //anchors.centerIn: parent
                }
                Button {
                    text: "ListView"
                    onClicked: stack.push(view2)
                }
                Button {
                    text: "MouseArea"
                    onClicked: stack.push(view3)
                }
                Button {
                    text: "GridView"
                    onClicked: stack.push(view4)
                }
                Rectangle {
                    Layout.fillWidth: true
                    Layout.fillHeight: true
                    //color: "blue"
                }
            }
        }
    }

    Component {
        id: view2

        Rectangle {
            ColumnLayout {
                //Layout.alignment:  Qt.AlignCenter
                anchors.fill: parent

                Test_TitleBar { }

                Button {
                    text: "ListView"
                    onClicked: stack.push(view2)
                }

                Test_ListView { }
            }
        }
    }

    Component {
        id: view3

        Rectangle {
            ColumnLayout {
                anchors.fill: parent
                Test_TitleBar { }
                Rectangle{
                    Layout.fillWidth: true
                    height: 20
                    Text { id: text  }
                }
                Rectangle {
                    Layout.fillWidth: true
                    Layout.fillHeight: true
                    color: "red"

                    MouseArea {
                        id: mouseArea
                        anchors.fill: parent
                        hoverEnabled: true

                        onClicked:  { text.text = "单击" }
                        onDoubleClicked:  { text.text = "双击" }
                        onEntered: { text.text = "鼠标进入" }
                        onExited: { text.text = "鼠标离开" }
                        onPressAndHold: { text.text = "onPressAndHold" }
                        onPressed: { text.text = "onPressed" }
                        onReleased: { text.text = "onReleased" }
                        onWheel: { text.text = "onWheel" }
                    }
                }
            }
        }
    }


    Component {
        id: view4
        Test_GridView { }

    }

}

/*
Rectangle {
    id: rectMain
    width: 300
    height: 300
    objectName: "rectMain"
    anchors.fill: parent
    //color: "red"

//    MouseArea {
//        id: mouseArea
//        anchors.fill: parent
//        hoverEnabled: true

//        onClicked:  { text.text = "单击" }
//        onDoubleClicked:  { text.text = "双击" }
//        onEntered: { text.text = "鼠标进入" }
//        onExited: { text.text = "鼠标离开" }
//        onPressAndHold: { text.text = "onPressAndHold" }
//        onPressed: { text.text = "onPressed" }
//        onReleased: { text.text = "onReleased" }
//        onWheel: { text.text = "onWheel" }
//    }

    ComboBox {
        width: 200
        x: 200
        y: 200
        model: [ "Banana", "Apple", "Coconut" ]
    }

    BusyIndicator {
        running: true
    }

    Column {
        CheckBox {
            text: qsTr("Breakfast")
            checked: true
        }
        CheckBox {
            text: qsTr("Lunch")
        }
        CheckBox {
            text: qsTr("Dinner")
            checked: true
        }
        Switch { checked: true }
        Switch { checked: false }
    }

    Text {
        id: text
        x: 0
        y: 0
    }
}*/

